﻿#include "lookup.h"
#include "ui_lookup.h"
#include "datainfo.h"

#include <QCalendarWidget>

LookUp::LookUp(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::LookUp)
{
    ui->setupUi(this);
    setWindowTitle("信息录入系统");
    listTable();
}

LookUp::~LookUp()
{
    delete ui;
}
//回退
void LookUp::on_pushButton_clicked()
{
    this->parentWidget()->show();
    delete this;
}

void LookUp::on_dateEdit_dateChanged(const QDate &date)
{
    QString table_name;
    table_name.append(date.year());
    table_name.append(date.month());
    table_name.append(date.day());
    qDebug() << table_name ;
}
//签到表的列表
void LookUp::listTable(){
    //当前时间
    QString time;
    for (int i = 0; i > -30; i --){
        time = QDateTime::currentDateTime().addDays(i).toString("yyyyMMdd");
        qDebug() << time;
        ui->listWidget->addItem(time);
    }
}


void LookUp::on_listWidget_itemClicked(QListWidgetItem *item)
{
    QString table_name = item->text();
    qDebug() << table_name;
    DataInfo *w = new DataInfo(this);
    w->setTableName(table_name);
    w->showTable();
    w->show();
    this->hide();

}
